import Vue from 'vue'
import VueRouter from 'vue-router'
// import Parent from '../views/Parent.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/form'
  },
  {
    path:'/home/:id', // 动态路由，在path后添加/:参数 的方式
    name:'home',
    component:()=>import('../views/Home.vue'),
    children:[
      { // 嵌套路由
        path:'/child',
        name:'child',
        component:()=>import('../views/Child.vue')
      }
    ]
  },
  {
    path:'/child',
    name:'child',
    component:()=>import('../views/Child.vue')
  },
  {
    path:'/layout',
    name:'layout',
    component:()=>import('../views/element/Layout.vue')
  },
  {
    path:'/pop',
    name:'pop',
    component:()=>import('../views/element/Pop.vue')
  },
  {
    path:'/table',
    name:'table',
    component:()=>import('../views/element/Table.vue')
  },
  {
    path:'/form',
    name:'form',
    component:()=>import('../views/element/Form.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router
